package com.jun.basic.controller;

import com.jun.basic.domain.Video;
import com.jun.basic.service.impl.VideoServiceImpl;
import com.jun.basic.utils.JsonData;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@RestController
@RequestMapping("/api/v1/video")
public class VideoController {
    @Resource
    private VideoServiceImpl videoService;

    @GetMapping("/list")
    public JsonData<List<Video>> getVideoList(@RequestParam("id") Long id) {
        log.info("入参id={}", id);
        return JsonData.buildSuccess(videoService.listVideo());
    }

    @PostMapping("/save")
    public JsonData<String> saveVideo(@RequestBody Video video) {
        log.info(video.toString());
        return JsonData.buildSuccess("成功save");
    }
}
